<template>
	<view class="mainPage whitePage" :style="{'padding-top': `${$store.state.safeArea.top || 0}px`, 'padding-bottom': `${$store.state.safeArea.bottom || 0}px`}">
		<public-head :title="title" onlyHead noshadow></public-head>
		<view class="box">
			<text>*</text>完成实名认证后，可开通在线问诊服务
		</view>
		<view class="box2">
			<view class="title">执业兽医资格证</view>
			<view class="zheng">
				<u-upload :action="action" :maxCount="1" @on-success="change()" @on-remove="del()"  ></u-upload>
			</view>
			<view class="title2">请拍摄证书清晰照片，需包含姓名，个人照片及钢印、证书编号</view>
		</view>
		<view class="box2">
			<view class="title">职称证书</view>
			<view class="zheng">
				<u-upload :action="action" :maxCount="1"  @on-success="changes()" @on-remove="dels()"></u-upload>
			</view>
			<view class="title2">没有职称证书可不提供，提供的证书需包含姓名、个人照片及钢印</view>
		</view>
		<view class="box3">
			<!-- <view class="but1"><button>上一步</button></view> -->
			<view class="but2" @click="next"><button>下一步</button></view>
		</view>
	</view>
</template>

<script>
	var that
	import publicHead from "@/components/publicHead/publicHead.vue"
	export default {
		components: {
			publicHead
		},
		data() {
			return {
				title: '医生注册',
				action: '',
				list:[],//兽医资格证
				lists:[],//职称证书
				item:{}
			}
		},
		onLoad(options) {
			that = this
			that.item = JSON.parse(options.item)
			that.action = that.$util.getUrl1() + 'Doctor_uploadFile';
		},
		methods:{
			// 兽医资格证上传成功返回
			change(e){
				console.log(e.data.url);
				that.list.push(e.data.url)
			},
			// 兽医资格证删除返回
			del(e){
				// console.log(e);
				that.list.splice(e,1)
			},
			// 职称证书上传成功返回
			changes(e){
				console.log(e);
				that.lists.push(e.data.url)
			},
			// 职称证书删除返回
			dels(e){
				console.log(e);
				that.lists.splice(e,1)
			},
			next(){
				console.log(that.list);
				console.log(that.lists);
				if(that.list == ''){
					uni.showToast({
						title: '请上传兽医资格证书',
						icon: 'none',
						duration: 1500
					});
					return
				}
				that.item.practice_cer = that.list[0]
				that.item.petdoc_cer = ''
				if(that.lists != ''){
					that.item.petdoc_cer = that.lists[0]
				}
				setTimeout(function(){
					uni.navigateTo({
						url:'UploadIDcard?item=' + JSON.stringify(that.item)
					})
				},100)
			}
		}
		
	}
</script>

<style  scoped lang="scss">
	.box{
		padding: 60rpx 30rpx;
		text{
			color: red;
		}
	}
	.box2{
		.title{
			padding:10rpx 30rpx;
		}
		.zheng{
			padding:10rpx 30rpx;
		}
		.title2{
			padding:30rpx 30rpx;
			font-size: 24rpx;
			font-family: PingFang SC;
			font-weight: 400;
			line-height: 34rpx;
			color: #979797;
			opacity: 1;
		}
	}
	.box3{
		width: 100%;
		position: absolute;
		bottom: 200rpx;
		.but1{
			height: 50rpx;
			line-height: 50rpx;
			display: inline-block;
			width: 50%;
			button{
				width: 80%;
				border: 1px  #F78361 solid;
				background: #FFFFFF;
				color:  #F78361;
				border-radius: 4rpx;
			}
		}
		.but2{
			height: 50rpx;
			line-height: 50rpx;
			display: inline-block;
			width: 100%;
			button{
				width: 80%;
				background: linear-gradient(227deg, #FF9331 0%, #FE7600 100%);
				opacity: 1;
				border-radius: 4rpx;
				color: #FFFFFF;
			}
		}
	}
</style>
